package com.itheima.propertiesio;

import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class PropertiesDemo1 {
    public static void main(String[] args) {
        Properties prop = new Properties();
        prop.put("小龙女", "尹志平");
        prop.put("郭襄", "杨过");
        prop.put("黄蓉", "欧阳克");
        System.out.println(prop);

        /*prop.remove("郭襄");
        System.out.println(prop);

        prop.put("小龙女", "杨过");
        System.out.println(prop);*/

//        Object value = prop.get("黄蓉");
//        System.out.println(value);

//        prop.keySet().forEach(key -> System.out.println(key));
        for (Object key : prop.keySet()) {
            Object value = prop.get(key);
            System.out.println(key + "=" + value);
        }

        System.out.println("===============================");

        Set<Map.Entry<Object, Object>> entries = prop.entrySet();
        for (Map.Entry<Object, Object> entry : entries) {
            Object key = entry.getKey();
            Object value = entry.getValue();
            System.out.println(key + "=" + value);
        }
    }
}
